import React, { Component } from 'react';
import { Form, Input, Row, Col, Button, message } from 'antd';

class RegistrationForm extends Component{

  formRef = React.createRef()

  constructor(props){
    super(props)
  }

  resetForm() {
    const form = this.formRef.current
    if (form) {
      const { resetFields } = form
      resetFields()
    }
  }

  render() {
    const {onFinish} = this.props
    return (
      <Form
        className={'loginForm'}
        ref={ this.formRef }
        name="login"
        onFinish={onFinish}
        scrollToFirstError
      >
        <Form.Item
          name="mobile"
          label=""
          rules={[
            {
              required: true,
              message: '请输入手机号码!'
            },
          ]}
        >
          <Input maxLength={11} placeholder="请输入手机号码" />
        </Form.Item>
        <Form.Item
          name="password"
          label=""
          rules={[
            {
              required: true,
              message: '请输入密码!'
            },
          ]}
        >
          <Input placeholder="请输入密码" type={'password'}/>
        </Form.Item>
        <Form.Item >
          <Button className={'loginBtn'} type="primary" htmlType="submit">
            登录
          </Button>
        </Form.Item>
      </Form>
    );
  }
}

export default RegistrationForm